package converter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;

import cn.edu.sdjzu.xg11.dao.ProjectTypeDao;
import cn.edu.sdjzu.xg11.domain.ProjectType;
/**
 * @author Acer
 * 将JSP中的ProjectType.id从String形式转换成ProjectType对象
 * 需要bysj-servlet.xml中配置
 */
public class StringToType implements Converter<String, ProjectType> {
	@Autowired
	private  ProjectTypeDao projectTypeDao;
	@Override
	public ProjectType convert(String string) {
		System.out.println("Convert Type:" + string);
		return projectTypeDao.getProjectType(new Integer(string));
	}

}
